﻿using MhAdmin.Application.Services.CMD.MasterDataGroup;
using MhAdmin.Application.Services.CMD.MasterDataGroup.Dto;

namespace MhAdmin.Web.Core.Controllers.System.CMD
{
	/// <summary>
	/// 系统主数据群组管理控制器
	/// </summary>
	[ApiDescriptionSettings(Tag = "主数据群组管理")]
	public class MasterDataGroupController : BaseController
	{
		private readonly IMasterDataGroupService masterDataGroupService;

		public MasterDataGroupController(IMasterDataGroupService masterDataGroupService)
		{
			this.masterDataGroupService = masterDataGroupService;
		}

		/// <summary>
		/// 添加主数据群组
		/// </summary>
		/// <param name="input"></param>
		/// <returns></returns>
		[HttpPost("add")]
		[DisplayName("添加主数据群组")]
		public async Task Add([FromBody] MasterDataGroupAddInput input)
		{
			await masterDataGroupService.Add(input);
		}

		/// <summary>
		/// 主数据群组分页查询
		/// </summary>
		/// <param name="input">查询参数</param>
		/// <returns>分页列表</returns>
		[HttpGet("page")]
		[DisplayName("主数据群组分页查询")]
		public async Task<dynamic> Page([FromQuery] MasterDataGroupPageInput input)
		{
			return await masterDataGroupService.Page(input);
		}

		/// <summary>
		/// 修改主数据群组
		/// </summary>
		/// <param name="input">修改参数</param>
		/// <returns></returns>
		[HttpPost("edit")]
		[DisplayName("修改主数据群组")]
		public async Task Edit([FromBody] MasterDataGroupEditInput input)
		{
			await masterDataGroupService.Edit(input);
		}

		/// <summary>
		/// 删除主数据群组
		/// </summary>
		/// <param name="input">id列表</param>
		/// <returns></returns>

		[HttpPost("delete")]
		[DisplayName("删除主数据群组")]
		public async Task Delete([FromBody] List<BaseIdInput> input)
		{
			await masterDataGroupService.Delete(input);
		}
	}
}
